import request from "@/utils/request"
import type { attrListModel, attrModel } from "./model/attrModel";

enum API{
  //获取平台属性 GET /admin/product/attrInfoList/{category1Id}/{category2Id}/{category3Id}
  getAttrList="admin/product/attrInfoList",
  // 添加或者修改平台属性值 POST /admin/product/saveAttrInfo
  saveAttr="/admin/product/saveAttrInfo",
  // 删除平台属性值 DELETE /admin/product/deleteAttr/{attrId}
  deleteAttr="/admin/product/deleteAttr"
}

export const getAttrListApi=(category1Id:number,category2Id:number,category3Id:number,)=>{
  return request.get<any,attrListModel>(API.getAttrList+`/${category1Id}/${category2Id}/${category3Id}`)
};
export const saveAttrApi=(attr:attrModel)=>{
  return request.post(API.saveAttr,attr)
};
export const deleteAttrApi=(attrId:number)=>{
  return request.delete(API.deleteAttr+`/${attrId}`)
}